//
//  TwoActvViewController.m
//  简单豆瓣不得不交版 1 带
//
//  Created by dllo on 16/6/24.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "TwoActvViewController.h"
#import "SignViewController.h"


#define WIDTH self.view.frame.size.width

#define HEIGHT self.view.frame.size.height


@interface TwoActvViewController ()


@property(nonatomic,retain)UITableView *MyTabelview;

@property(nonatomic,retain)NSMutableArray *myArray;

@end

@implementation TwoActvViewController

-(void)dealloc{
    
    [_myLabel1 release];
    [_myLabel2 release];
    [_myLabel3 release];
    [_myLabel4 release];
    [_myLabel5 release];
    [_myLabel6 release];
    
    [_myLabel7 release];
    [_mylabel8 release];
    
    
    [_myView release];
    [_myView1 release];
   
    
    [_myButton1 release];
    [_myButton2 release];
    [_myButton3 release];
    [_myButton4 release];
    
    
    [super dealloc];
    
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.myArray = [NSMutableArray array];
    // Do any additional setup after loading the view.

    self.navigationController.navigationBar.translucent = NO; 
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"btn_nav_back@2x.png"] style:UIBarButtonItemStylePlain target:self action:@selector(leftAction)];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"btn_nav_share@2x.png"] style:UIBarButtonItemStylePlain target:self action:@selector(rightAction)];

    
    UIScrollView *BigS = [[UIScrollView alloc]initWithFrame:CGRectMake(10, 0,WIDTH - 20, HEIGHT)];
    
    BigS.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:BigS];
    [BigS release];
    
    //计算文字高度
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:17],NSFontAttributeName, nil];
    //这里的宽度是和我们要显示的宽度一样
    CGRect rect = [self.model.content boundingRectWithSize:CGSizeMake(WIDTH - 40, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    
    //加详情文字  滚动
    
    UIScrollView *view1 = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 300,WIDTH - 40, rect.size.height )];
    
    view1.backgroundColor = [UIColor whiteColor];
    [BigS addSubview:view1];
    [view1 release];

    
    //滑动页数
    BigS.contentSize = CGSizeMake(0,rect.size.height + 364);

    
    
    
    
    
    
    
    
    
    
    
    //滑动页数
  //  view1.contentSize = CGSizeMake(0, rect.size.height + 364);
    
    self.mylabel8 = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, WIDTH - 40, rect.size.height)];
    
    [view1 addSubview:self.mylabel8];
    [_mylabel8 release];
    
    self.mylabel8.text = self.model.content;
    //[self.mylabel8 sizeToFit];
    self.mylabel8.numberOfLines  = 0;

    //布局
    self.myView = [[UIImageView alloc]init];
    self.myView.backgroundColor = [UIColor whiteColor];
    [BigS addSubview:self.myView];
    self.myView.frame = CGRectMake(0, 0,WIDTH , HEIGHT / 3  + 50);
    [_myView release];
    
    self.myView1 = [[UIImageView alloc]init];
    self.myView1.backgroundColor = [UIColor clearColor];
    [BigS addSubview:self.myView1];
    [self.myView1 sd_setImageWithURL:[NSURL URLWithString:self.model.image]];
    [_myView1 release];
    
    
    self.myLabel1 = [[UILabel alloc]init];
    self.myLabel1.backgroundColor = [UIColor clearColor];
    [BigS addSubview:self.myLabel1];
    
    [_myLabel1 release];
    
    
    self.myLabel2 = [[UILabel alloc]init];
    self.myLabel2.backgroundColor = [UIColor clearColor];
    [BigS addSubview:self.myLabel2];
    [_myLabel2 release];
    
    
    self.myLabel3 = [[UILabel alloc]init];
    self.myLabel3.backgroundColor = [UIColor clearColor];
    [BigS addSubview:self.myLabel3];
    [_myLabel3 release];
    
    self.myLabel4 = [[UILabel alloc]init];
    self.myLabel4.backgroundColor = [UIColor clearColor];
    [BigS addSubview:self.myLabel4];
    [_myLabel4 release];
    
    
    self.myLabel5 = [[UILabel alloc]init];
    self.myLabel5.backgroundColor = [UIColor clearColor];
    [BigS addSubview:self.myLabel5];
    [_myLabel5 release];
    
    self.myLabel6 = [[UILabel alloc]init];
    self.myLabel6.backgroundColor = [UIColor clearColor];
    [BigS addSubview:self.myLabel6];
    [_myLabel6 release];
    
    self.myLabel7 = [[UILabel alloc]init];
    self.myLabel7.backgroundColor = [UIColor clearColor];
    [BigS addSubview:self.myLabel7];
    [_myLabel7 release];
    
    
    self.myButton1 = [UIButton buttonWithType:UIButtonTypeCustom];
    self.myButton1.backgroundColor = [UIColor clearColor];
    [BigS addSubview:self.myButton1];
    [_myButton1 release];
    
    self.myButton2 = [UIButton buttonWithType:UIButtonTypeCustom];
    self.myButton2.backgroundColor = [UIColor clearColor];
    [BigS addSubview:self.myButton2];
    [_myButton2 release];
    
    
    self.myButton3 = [UIButton buttonWithType:UIButtonTypeCustom];
    self.myButton3.backgroundColor = [UIColor clearColor];
    [BigS addSubview:self.myButton3];
    [_myButton3 release];
    
    self.myButton4 = [UIButton buttonWithType:UIButtonTypeCustom];
    self.myButton4.backgroundColor = [UIColor clearColor];
    [BigS addSubview:self.myButton4];
    [_myButton4 release];
    
    // 头势图上加名字
    self.touLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,0, 200, 44)];
    self.touLabel.font = [UIFont boldSystemFontOfSize:20];
    self.touLabel.textColor = [UIColor blackColor];
    self.touLabel.textAlignment = NSTextAlignmentCenter;
    self.navigationItem.titleView = _touLabel;
    self.touLabel.text = _model.title;
    
    
    self.myView1.frame = CGRectMake(20, 60, 115, 160);
    
    
    
    self.myLabel1.frame = CGRectMake(20, 10, 300, 40);
    self.myLabel2.frame = CGRectMake(190, 60, 200, 30);
    self.myLabel3.frame = CGRectMake(190, 100, 200, 30);
    self.myLabel4.frame = CGRectMake(190, 140, 50, 30);
    self.myLabel5.frame = CGRectMake(250, 140, 50, 30);
    self.myLabel6.frame = CGRectMake(190, 180, 200, 60);
    self.myLabel7.frame = CGRectMake(20, 240, 200, 50);
    
    
    self.myButton1.frame = CGRectMake(150, 60, 35, 30);
    self.myButton2.frame = CGRectMake(150, 100, 35, 30);
    self.myButton3.frame = CGRectMake(150, 140, 35, 30);
    self.myButton4.frame = CGRectMake(150, 180, 35, 30);
    
    self.myLabel1.text = self.model.title;
    self.myLabel2.text = self.model.begin_time;
         
    self.myLabel4.text = @"类型:";
    self.myLabel5.text = self.model.category_name;
    self.myLabel6.text = self.model.address;
    self.myLabel6.numberOfLines = 0;
    self.myLabel7.text = @"活动详情";
    self.myLabel7.font = [UIFont systemFontOfSize:25 weight:1];
    
    [self.myButton1 setImage:[UIImage imageNamed:@"icon_date_blue@2x.png"] forState:UIControlStateNormal];
    [self.myButton2 setImage:[UIImage imageNamed:@"icon_sponsor_blue@2x.png"] forState:UIControlStateNormal];
    [self.myButton3 setImage:[UIImage imageNamed:@"icon_catalog_blue@2x.png"] forState:UIControlStateNormal];
    [self.myButton4 setImage:[UIImage imageNamed:@"icon_spot_blue@2x.png"] forState:UIControlStateNormal];
    
  
 

// Do any additional setup after loading the view.
    
}




//返回方法





-(void)leftAction{
    
    
    [self.navigationController popToRootViewControllerAnimated:YES];
}

- (void)rightAction {
    SignViewController *sigVC = [[SignViewController alloc] init];
    [self.navigationController pushViewController:sigVC animated:YES];
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

 
@end
